<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .test {
            width: 100px;
            height: 100px;
            background-color: #f40;
            /* transform: scale(.5, .5); */
        }

        .test2 {
            width: 100px;
            height: 100px;
            background-color: #009c9c;
        }
    </style>
</head>
<body>
    <div class="" style="position: relative;margin-top: 10px; padding-top: 15px; border: .5px solid #ff0000">
        <a href="#/about">about</a>
        <a href="#/home">about</a>
		<!-- 根据 UI 和 hash 对应的路径渲染对应的UI -->
		<div id="routerview">
			
		</div>
    </div>

    <script>	
        window.addEventListener('hashchange', () => {
			let hash = location.hash;
			routerview.innerHTML = hash;
		});
		
		window.addEventListener('DOMContentLoaded', () => {
			if(!location.hash) {
				location.hash = '/';
			} else {
				let hash = location.hash;
				routerview.innerHTML = hash;
			}
		})
    </script>
</body>
</html>